import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
    name: 'safaWorkingTimePip'
})
export class SafaWorkingTimePip implements PipeTransform {
    transform(num: number, n: number): any {
        return (Array(n).join('0') + num).slice(-n);
    }
}

export class ObjectPipe{
   static preProcessData(formData): any {
        Object.keys(formData).forEach(item => {
            if (this.isEmpty(formData[item])) {
                delete formData[item];
            }
        });
        return formData;
    }

    static isEmpty(obj) {
        if (typeof obj === 'undefined' || obj === null || obj === '') {
            return true;
        }else {
            return false;
        }
    }

}
